/*
 * linuxrc-simple.c
 *
 * Copyright (C) 2008 Alexey Kopytko <alexey@kopytko.ru>
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2.  This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */


#define REALROOT "0x0903"

#include <sys/mount.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>

/*
armv5tejl-softfloat-linux-gnueabi-gcc -static linuxrc-simple.c -o /tmp/linuxrc
*/

int main() {
	mkdir("/proc", 0755);
	mount("none", "/proc", "proc", 0, 0);
	FILE *file = fopen ("/proc/sys/kernel/real-root-dev", "w");
	fprintf(file, REALROOT); /* /dev/md3 */
	fclose(file);
	umount("/proc");
	exit(0);
}

